﻿using System;
using JetBrains.Annotations;

namespace Kaleida.ServiceMonitor.Model.Runtime
{
    public class OperationError
    {
        private readonly string message;
        private readonly DateTime receivedOn;

        public OperationError([NotNull] string message, DateTime receivedOn)
        {
            if (message == null) throw new ArgumentNullException("message");
            if (message == "") throw new ArgumentException("Cannot be blank", "message");

            this.message = message;
            this.receivedOn = receivedOn;
        }

        public string Message
        {
            get { return message; }
        }

        public DateTime ReceivedOn
        {
            get { return receivedOn; }
        }

        public override string ToString()
        {
            return string.Format("{0:dd-MMM-yyyy HH:mm:ss} {1}", receivedOn, message);
        }
    }
}
